<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>字符串运算符</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="language.operators.logical.html">« 逻辑运算符</a></li>
      <li style="float: right;"><a href="language.operators.array.html">数组运算符 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="language.operators.html">运算符</a></li>
    <li>字符串运算符</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="language.operators.string" class="sect1">
   <h2 class="title">字符串运算符</h2>
   <p class="simpara">
    有两个字符串（<span class="type">string</span>）运算符。第一个是连接运算符（“.”），它返回其左右参数连接后的字符串。第二个是连接赋值运算符（“<code class="literal">.=</code>”），它将右边参数附加到左边的参数之后。更多信息见<a href="language.operators.assignment.html" class="link">赋值运算符</a>。
   </p>

   <p class="para">
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Hello&nbsp;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"World!"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;现在&nbsp;$b&nbsp;包含&nbsp;"Hello&nbsp;World!"<br /><br /></span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Hello&nbsp;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"World!"</span><span style="color: #007700">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;现在&nbsp;$a&nbsp;包含&nbsp;"Hello&nbsp;World!"<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </p>

   <div class="sect2">
    <h3 class="title">参见</h3>
    <p class="para">
     <ul class="simplelist">
      <li class="member"><a href="language.types.string.html" class="link">字符串类型</a></li>
      <li class="member"><a href="ref.strings.html" class="link">字符串函数</a></li>
     </ul>
    </p>
   </div>
  </div></div></div></body></html>